package com.dragon.modules.yuegou.query.wallet;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.dragon.modules.yuegou.entity.wallet.InvoiceEntity;
import com.dragon.modules.yuegou.enums.wallet.InvoiceStatus;
import com.dragon.modules.yuegou.mybatis.Condition;
import com.dragon.modules.yuegou.mybatis.Query;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.annotation.JsonUnwrapped;

import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.LocalDateTime;

/**
 * 发票（商户向企业开的发票） 动态查询条件
 * 
 * @author pbuilder generated
 * @date 2019-10-10 16:53:50
 * @version 2.0
 */
@JsonInclude(Include.NON_NULL)
public class InvoiceQuery extends InvoiceEntity implements Query<InvoiceEntity> {

    /** 发票ID查询条件 */
	@JsonUnwrapped(prefix = "id")
	private Condition<String> idCondition;

    /** 商圈ID查询条件 */
	@JsonUnwrapped(prefix = "busdId")
	private Condition<String> busdIdCondition;

    /** 商户ID查询条件 */
	@JsonUnwrapped(prefix = "merchantId")
	private Condition<String> merchantIdCondition;

    /** 商户名称查询条件 */
	@JsonUnwrapped(prefix = "merchantName")
	private Condition<String> merchantNameCondition;

    /** 企业ID查询条件 */
	@JsonUnwrapped(prefix = "companyId")
	private Condition<String> companyIdCondition;

    /** 企业名称查询条件 */
	@JsonUnwrapped(prefix = "companyName")
	private Condition<String> companyNameCondition;

    /** 发票开始日期（包含）查询条件 */
	@JsonUnwrapped(prefix = "startDate")
	private Condition<LocalDate> startDateCondition;

    /** 发票截止日期（包含）查询条件 */
	@JsonUnwrapped(prefix = "endDate")
	private Condition<LocalDate> endDateCondition;

    /** 开票金额查询条件 */
	@JsonUnwrapped(prefix = "amount")
	private Condition<BigDecimal> amountCondition;

    /** [枚举]状态：0-未发送-UNSEND、1-未结算-UNSETTING、2-已结算-SETTED查询条件 */
	@JsonUnwrapped(prefix = "status")
	private Condition<InvoiceStatus> statusCondition;

    /** 创建时间查询条件 */
	@JsonUnwrapped(prefix = "createdTime")
	private Condition<LocalDateTime> createdTimeCondition;

    /** 开票时间查询条件 */
	@JsonUnwrapped(prefix = "invoiceTime")
	private Condition<LocalDateTime> invoiceTimeCondition;

    /** 发票号查询条件 */
	@JsonUnwrapped(prefix = "invoiceNo")
	private Condition<String> invoiceNoCondition;

    /** 发票抬头查询条件 */
	@JsonUnwrapped(prefix = "invoiceTitle")
	private Condition<String> invoiceTitleCondition;

    /** 结算月 yyyy-MM格式查询条件 */
	@JsonUnwrapped(prefix = "settlementMonth")
	private Condition<String> settlementMonthCondition;

    /** 结算人查询条件 */
	@JsonUnwrapped(prefix = "settleBy")
	private Condition<String> settleByCondition;

    /** 结算时间查询条件 */
	@JsonUnwrapped(prefix = "settleTime")
	private Condition<LocalDateTime> settleTimeCondition;

	/**
	 * 构造一个查询条件对象
	 */
	public InvoiceQuery() {
		super();
	}

	/**
	 * 依据实体对象构造一个查询条件对象
	 * 
	 * @param entity 实体对象
	 */
	public InvoiceQuery(InvoiceEntity entity) {
		super(entity);
	}

	/**
	 * 依据其它查询条件对象的信息构造一个查询条件对象
	 * 
	 * @param other 查询条件对象
	 */
	public InvoiceQuery(InvoiceQuery other) {
		super(other);
		if(other.idCondition != null) {
			this.idCondition = other.idCondition.copy();
		}
		if(other.busdIdCondition != null) {
			this.busdIdCondition = other.busdIdCondition.copy();
		}
		if(other.merchantIdCondition != null) {
			this.merchantIdCondition = other.merchantIdCondition.copy();
		}
		if(other.merchantNameCondition != null) {
			this.merchantNameCondition = other.merchantNameCondition.copy();
		}
		if(other.companyIdCondition != null) {
			this.companyIdCondition = other.companyIdCondition.copy();
		}
		if(other.companyNameCondition != null) {
			this.companyNameCondition = other.companyNameCondition.copy();
		}
		if(other.startDateCondition != null) {
			this.startDateCondition = other.startDateCondition.copy();
		}
		if(other.endDateCondition != null) {
			this.endDateCondition = other.endDateCondition.copy();
		}
		if(other.amountCondition != null) {
			this.amountCondition = other.amountCondition.copy();
		}
		if(other.statusCondition != null) {
			this.statusCondition = other.statusCondition.copy();
		}
		if(other.createdTimeCondition != null) {
			this.createdTimeCondition = other.createdTimeCondition.copy();
		}
		if(other.invoiceTimeCondition != null) {
			this.invoiceTimeCondition = other.invoiceTimeCondition.copy();
		}
		if(other.invoiceNoCondition != null) {
			this.invoiceNoCondition = other.invoiceNoCondition.copy();
		}
		if(other.invoiceTitleCondition != null) {
			this.invoiceTitleCondition = other.invoiceTitleCondition.copy();
		}
		this.setOther(other);
	}
	private void setOther(InvoiceQuery other){
		if(other.settlementMonthCondition != null) {
			this.settlementMonthCondition = other.settlementMonthCondition.copy();
		}
		if(other.settleByCondition != null) {
			this.settleByCondition = other.settleByCondition.copy();
		}
		if(other.settleTimeCondition != null) {
			this.settleTimeCondition = other.settleTimeCondition.copy();
		}
	}

	@Override
	public QueryWrapper<InvoiceEntity> toQueryWrapper() {
		QueryWrapper<InvoiceEntity> wrapper = new QueryWrapper<>(this);
		if (idCondition != null) {
			idCondition.toWrapper(wrapper, COL_ID);
		}
		if (busdIdCondition != null) {
			busdIdCondition.toWrapper(wrapper, COL_BUSD_ID);
		}
		if (merchantIdCondition != null) {
			merchantIdCondition.toWrapper(wrapper, COL_MERCHANT_ID);
		}
		if (merchantNameCondition != null) {
			merchantNameCondition.toWrapper(wrapper, COL_MERCHANT_NAME);
		}
		if (companyIdCondition != null) {
			companyIdCondition.toWrapper(wrapper, COL_COMPANY_ID);
		}
		if (companyNameCondition != null) {
			companyNameCondition.toWrapper(wrapper, COL_COMPANY_NAME);
		}
		if (startDateCondition != null) {
			startDateCondition.toWrapper(wrapper, COL_START_DATE);
		}
		if (endDateCondition != null) {
			endDateCondition.toWrapper(wrapper, COL_END_DATE);
		}
		if (amountCondition != null) {
			amountCondition.toWrapper(wrapper, COL_AMOUNT);
		}
		if (statusCondition != null) {
			statusCondition.toWrapper(wrapper, COL_STATUS);
		}
		if (createdTimeCondition != null) {
			createdTimeCondition.toWrapper(wrapper, COL_CREATED_TIME);
		}
		if (invoiceTimeCondition != null) {
			invoiceTimeCondition.toWrapper(wrapper, COL_INVOICE_TIME);
		}
		if (invoiceNoCondition != null) {
			invoiceNoCondition.toWrapper(wrapper, COL_INVOICE_NO);
		}
		if (invoiceTitleCondition != null) {
			invoiceTitleCondition.toWrapper(wrapper, COL_INVOICE_TITLE);
		}
		return getQueryWrapper(wrapper);
	}
	private QueryWrapper<InvoiceEntity> getQueryWrapper(QueryWrapper<InvoiceEntity> wrapper){
		if (settlementMonthCondition != null) {
			settlementMonthCondition.toWrapper(wrapper, COL_SETTLEMENT_MONTH);
		}
		if (settleByCondition != null) {
			settleByCondition.toWrapper(wrapper, COL_SETTLE_BY);
		}
		if (settleTimeCondition != null) {
			settleTimeCondition.toWrapper(wrapper, COL_SETTLE_TIME);
		}
		return wrapper;
	}

	/**
	 * 构造并返回发票ID查询条件
	 * 
	 * @return idCondition 发票ID查询条件
	 */
	public Condition<String> id() {
		this.idCondition = new Condition<>();
		return this.idCondition;
	}
	
	/**
	 * 获取发票ID查询条件
	 * 
	 * @return idCondition 发票ID查询条件
	 */
	public Condition<String> getIdCondition() {
		return idCondition;
	}

	/**
	 * 设置发票ID查询条件
	 * 
	 * @param idCondition 发票ID查询条件
	 */
	public void setIdCondition(Condition<String> idCondition) {
		this.idCondition = idCondition;
	}

	/**
	 * 构造并返回商圈ID查询条件
	 * 
	 * @return busdIdCondition 商圈ID查询条件
	 */
	public Condition<String> busdId() {
		this.busdIdCondition = new Condition<>();
		return this.busdIdCondition;
	}
	
	/**
	 * 获取商圈ID查询条件
	 * 
	 * @return busdIdCondition 商圈ID查询条件
	 */
	public Condition<String> getBusdIdCondition() {
		return busdIdCondition;
	}

	/**
	 * 设置商圈ID查询条件
	 * 
	 * @param busdIdCondition 商圈ID查询条件
	 */
	public void setBusdIdCondition(Condition<String> busdIdCondition) {
		this.busdIdCondition = busdIdCondition;
	}

	/**
	 * 构造并返回商户ID查询条件
	 * 
	 * @return merchantIdCondition 商户ID查询条件
	 */
	public Condition<String> merchantId() {
		this.merchantIdCondition = new Condition<>();
		return this.merchantIdCondition;
	}
	
	/**
	 * 获取商户ID查询条件
	 * 
	 * @return merchantIdCondition 商户ID查询条件
	 */
	public Condition<String> getMerchantIdCondition() {
		return merchantIdCondition;
	}

	/**
	 * 设置商户ID查询条件
	 * 
	 * @param merchantIdCondition 商户ID查询条件
	 */
	public void setMerchantIdCondition(Condition<String> merchantIdCondition) {
		this.merchantIdCondition = merchantIdCondition;
	}

	/**
	 * 构造并返回商户名称查询条件
	 * 
	 * @return merchantNameCondition 商户名称查询条件
	 */
	public Condition<String> merchantName() {
		this.merchantNameCondition = new Condition<>();
		return this.merchantNameCondition;
	}
	
	/**
	 * 获取商户名称查询条件
	 * 
	 * @return merchantNameCondition 商户名称查询条件
	 */
	public Condition<String> getMerchantNameCondition() {
		return merchantNameCondition;
	}

	/**
	 * 设置商户名称查询条件
	 * 
	 * @param merchantNameCondition 商户名称查询条件
	 */
	public void setMerchantNameCondition(Condition<String> merchantNameCondition) {
		this.merchantNameCondition = merchantNameCondition;
	}

	/**
	 * 构造并返回企业ID查询条件
	 * 
	 * @return companyIdCondition 企业ID查询条件
	 */
	public Condition<String> companyId() {
		this.companyIdCondition = new Condition<>();
		return this.companyIdCondition;
	}
	
	/**
	 * 获取企业ID查询条件
	 * 
	 * @return companyIdCondition 企业ID查询条件
	 */
	public Condition<String> getCompanyIdCondition() {
		return companyIdCondition;
	}

	/**
	 * 设置企业ID查询条件
	 * 
	 * @param companyIdCondition 企业ID查询条件
	 */
	public void setCompanyIdCondition(Condition<String> companyIdCondition) {
		this.companyIdCondition = companyIdCondition;
	}

	/**
	 * 构造并返回企业名称查询条件
	 * 
	 * @return companyNameCondition 企业名称查询条件
	 */
	public Condition<String> companyName() {
		this.companyNameCondition = new Condition<>();
		return this.companyNameCondition;
	}
	
	/**
	 * 获取企业名称查询条件
	 * 
	 * @return companyNameCondition 企业名称查询条件
	 */
	public Condition<String> getCompanyNameCondition() {
		return companyNameCondition;
	}

	/**
	 * 设置企业名称查询条件
	 * 
	 * @param companyNameCondition 企业名称查询条件
	 */
	public void setCompanyNameCondition(Condition<String> companyNameCondition) {
		this.companyNameCondition = companyNameCondition;
	}

	/**
	 * 构造并返回发票开始日期（包含）查询条件
	 * 
	 * @return startDateCondition 发票开始日期（包含）查询条件
	 */
	public Condition<LocalDate> startDate() {
		this.startDateCondition = new Condition<>();
		return this.startDateCondition;
	}
	
	/**
	 * 获取发票开始日期（包含）查询条件
	 * 
	 * @return startDateCondition 发票开始日期（包含）查询条件
	 */
	public Condition<LocalDate> getStartDateCondition() {
		return startDateCondition;
	}

	/**
	 * 设置发票开始日期（包含）查询条件
	 * 
	 * @param startDateCondition 发票开始日期（包含）查询条件
	 */
	public void setStartDateCondition(Condition<LocalDate> startDateCondition) {
		this.startDateCondition = startDateCondition;
	}

	/**
	 * 构造并返回发票截止日期（包含）查询条件
	 * 
	 * @return endDateCondition 发票截止日期（包含）查询条件
	 */
	public Condition<LocalDate> endDate() {
		this.endDateCondition = new Condition<>();
		return this.endDateCondition;
	}
	
	/**
	 * 获取发票截止日期（包含）查询条件
	 * 
	 * @return endDateCondition 发票截止日期（包含）查询条件
	 */
	public Condition<LocalDate> getEndDateCondition() {
		return endDateCondition;
	}

	/**
	 * 设置发票截止日期（包含）查询条件
	 * 
	 * @param endDateCondition 发票截止日期（包含）查询条件
	 */
	public void setEndDateCondition(Condition<LocalDate> endDateCondition) {
		this.endDateCondition = endDateCondition;
	}

	/**
	 * 构造并返回开票金额查询条件
	 * 
	 * @return amountCondition 开票金额查询条件
	 */
	public Condition<BigDecimal> amount() {
		this.amountCondition = new Condition<>();
		return this.amountCondition;
	}
	
	/**
	 * 获取开票金额查询条件
	 * 
	 * @return amountCondition 开票金额查询条件
	 */
	public Condition<BigDecimal> getAmountCondition() {
		return amountCondition;
	}

	/**
	 * 设置开票金额查询条件
	 * 
	 * @param amountCondition 开票金额查询条件
	 */
	public void setAmountCondition(Condition<BigDecimal> amountCondition) {
		this.amountCondition = amountCondition;
	}

	/**
	 * 构造并返回[枚举]状态：0-未发送-UNSEND、1-未结算-UNSETTING、2-已结算-SETTED查询条件
	 * 
	 * @return statusCondition [枚举]状态：0-未发送-UNSEND、1-未结算-UNSETTING、2-已结算-SETTED查询条件
	 */
	public Condition<InvoiceStatus> status() {
		this.statusCondition = new Condition<>();
		return this.statusCondition;
	}
	
	/**
	 * 获取[枚举]状态：0-未发送-UNSEND、1-未结算-UNSETTING、2-已结算-SETTED查询条件
	 * 
	 * @return statusCondition [枚举]状态：0-未发送-UNSEND、1-未结算-UNSETTING、2-已结算-SETTED查询条件
	 */
	public Condition<InvoiceStatus> getStatusCondition() {
		return statusCondition;
	}

	/**
	 * 设置[枚举]状态：0-未发送-UNSEND、1-未结算-UNSETTING、2-已结算-SETTED查询条件
	 * 
	 * @param statusCondition [枚举]状态：0-未发送-UNSEND、1-未结算-UNSETTING、2-已结算-SETTED查询条件
	 */
	public void setStatusCondition(Condition<InvoiceStatus> statusCondition) {
		this.statusCondition = statusCondition;
	}

	/**
	 * 构造并返回创建时间查询条件
	 * 
	 * @return createdTimeCondition 创建时间查询条件
	 */
	public Condition<LocalDateTime> createdTime() {
		this.createdTimeCondition = new Condition<>();
		return this.createdTimeCondition;
	}
	
	/**
	 * 获取创建时间查询条件
	 * 
	 * @return createdTimeCondition 创建时间查询条件
	 */
	public Condition<LocalDateTime> getCreatedTimeCondition() {
		return createdTimeCondition;
	}

	/**
	 * 设置创建时间查询条件
	 * 
	 * @param createdTimeCondition 创建时间查询条件
	 */
	public void setCreatedTimeCondition(Condition<LocalDateTime> createdTimeCondition) {
		this.createdTimeCondition = createdTimeCondition;
	}

	/**
	 * 构造并返回开票时间查询条件
	 * 
	 * @return invoiceTimeCondition 开票时间查询条件
	 */
	public Condition<LocalDateTime> invoiceTime() {
		this.invoiceTimeCondition = new Condition<>();
		return this.invoiceTimeCondition;
	}
	
	/**
	 * 获取开票时间查询条件
	 * 
	 * @return invoiceTimeCondition 开票时间查询条件
	 */
	public Condition<LocalDateTime> getInvoiceTimeCondition() {
		return invoiceTimeCondition;
	}

	/**
	 * 设置开票时间查询条件
	 * 
	 * @param invoiceTimeCondition 开票时间查询条件
	 */
	public void setInvoiceTimeCondition(Condition<LocalDateTime> invoiceTimeCondition) {
		this.invoiceTimeCondition = invoiceTimeCondition;
	}

	/**
	 * 构造并返回发票号查询条件
	 * 
	 * @return invoiceNoCondition 发票号查询条件
	 */
	public Condition<String> invoiceNo() {
		this.invoiceNoCondition = new Condition<>();
		return this.invoiceNoCondition;
	}
	
	/**
	 * 获取发票号查询条件
	 * 
	 * @return invoiceNoCondition 发票号查询条件
	 */
	public Condition<String> getInvoiceNoCondition() {
		return invoiceNoCondition;
	}

	/**
	 * 设置发票号查询条件
	 * 
	 * @param invoiceNoCondition 发票号查询条件
	 */
	public void setInvoiceNoCondition(Condition<String> invoiceNoCondition) {
		this.invoiceNoCondition = invoiceNoCondition;
	}

	/**
	 * 构造并返回发票抬头查询条件
	 * 
	 * @return invoiceTitleCondition 发票抬头查询条件
	 */
	public Condition<String> invoiceTitle() {
		this.invoiceTitleCondition = new Condition<>();
		return this.invoiceTitleCondition;
	}
	
	/**
	 * 获取发票抬头查询条件
	 * 
	 * @return invoiceTitleCondition 发票抬头查询条件
	 */
	public Condition<String> getInvoiceTitleCondition() {
		return invoiceTitleCondition;
	}

	/**
	 * 设置发票抬头查询条件
	 * 
	 * @param invoiceTitleCondition 发票抬头查询条件
	 */
	public void setInvoiceTitleCondition(Condition<String> invoiceTitleCondition) {
		this.invoiceTitleCondition = invoiceTitleCondition;
	}

	/**
	 * 构造并返回结算月 yyyy-MM格式查询条件
	 * 
	 * @return settlementMonthCondition 结算月 yyyy-MM格式查询条件
	 */
	public Condition<String> settlementMonth() {
		this.settlementMonthCondition = new Condition<>();
		return this.settlementMonthCondition;
	}
	
	/**
	 * 获取结算月 yyyy-MM格式查询条件
	 * 
	 * @return settlementMonthCondition 结算月 yyyy-MM格式查询条件
	 */
	public Condition<String> getSettlementMonthCondition() {
		return settlementMonthCondition;
	}

	/**
	 * 设置结算月 yyyy-MM格式查询条件
	 * 
	 * @param settlementMonthCondition 结算月 yyyy-MM格式查询条件
	 */
	public void setSettlementMonthCondition(Condition<String> settlementMonthCondition) {
		this.settlementMonthCondition = settlementMonthCondition;
	}

	/**
	 * 构造并返回结算人查询条件
	 * 
	 * @return settleByCondition 结算人查询条件
	 */
	public Condition<String> settleBy() {
		this.settleByCondition = new Condition<>();
		return this.settleByCondition;
	}
	
	/**
	 * 获取结算人查询条件
	 * 
	 * @return settleByCondition 结算人查询条件
	 */
	public Condition<String> getSettleByCondition() {
		return settleByCondition;
	}

	/**
	 * 设置结算人查询条件
	 * 
	 * @param settleByCondition 结算人查询条件
	 */
	public void setSettleByCondition(Condition<String> settleByCondition) {
		this.settleByCondition = settleByCondition;
	}

	/**
	 * 构造并返回结算时间查询条件
	 * 
	 * @return settleTimeCondition 结算时间查询条件
	 */
	public Condition<LocalDateTime> settleTime() {
		this.settleTimeCondition = new Condition<>();
		return this.settleTimeCondition;
	}
	
	/**
	 * 获取结算时间查询条件
	 * 
	 * @return settleTimeCondition 结算时间查询条件
	 */
	public Condition<LocalDateTime> getSettleTimeCondition() {
		return settleTimeCondition;
	}

	/**
	 * 设置结算时间查询条件
	 * 
	 * @param settleTimeCondition 结算时间查询条件
	 */
	public void setSettleTimeCondition(Condition<LocalDateTime> settleTimeCondition) {
		this.settleTimeCondition = settleTimeCondition;
	}

}
